package o;

import android.content.SharedPreferences;
import com.huawei.appgallery.serverreqkit.api.bean.ResponseBean;
import com.huawei.appgallery.serverreqkit.api.listener.IServerCallBack;
import com.huawei.appmarket.service.appdetail.bean.report.GeneralResponse;
import com.huawei.appmarket.service.appdetail.bean.report.GeneralResponse.ThirdInstallSwitch;
import com.huawei.appmarket.service.appdetail.bean.report.GeneralResponse.ThirdInstallSwitchData;

public class ebc {
    private static final ebc ॱ = new ebc();
    private int ˏ = -1;

    static class b implements IServerCallBack {
        private b() {
        }

        public void prePostResult(BaseRequest o_cvu, ResponseBean responseBean) {
        }

        public void notifyResult(BaseRequest o_cvu, ResponseBean responseBean) {
            if ((responseBean instanceof GeneralResponse) && responseBean.getResponseCode() == 0) {
                GeneralResponse generalResponse = (GeneralResponse) responseBean;
                if (generalResponse.getRtnCode_() == 0) {
                    ThirdInstallSwitch ˎ = generalResponse.ˎ();
                    if (ˎ != null) {
                        ThirdInstallSwitchData ˏ = ˎ.ˏ();
                        if (ˏ != null) {
                            ebc.ˊ().ˋ(ˏ.ˎ());
                            return;
                        }
                        return;
                    }
                    return;
                }
                Logger.ˏ("ThirdInstalled", "get data error, code: " + generalResponse.getRtnCode_());
            }
        }
    }

    private ebc() {
    }

    public static ebc ˊ() {
        return ॱ;
    }

    private SharedPreferences ˏ() {
        return ContentManager.getInstant().getContext().getSharedPreferences("thirdInstall", 0);
    }

    public boolean ˋ() {
        return ॱ() == 0 || 2 == ॱ();
    }

    public boolean ˎ() {
        return ॱ() == 0;
    }

    public int ॱ() {
        if (-1 == this.ˏ) {
            this.ˏ = ˏ().getInt("thirdInstall", -1);
            Logger.ˏ("ThirdInstalled", "get Type = " + this.ˏ);
            if (-1 == this.ˏ) {
                ʼ();
                return 0;
            }
        }
        return this.ˏ;
    }

    public void ˋ(int i) {
        this.ˏ = i;
        ˏ().edit().putInt("thirdInstall", i).commit();
    }

    private void ʼ() {
        cfw.ˎ(new drh("thirdInstall"), new b());
    }
}
